using System;
using System.Collections;
using System.Web.UI;
using Sedna.Core.Controller;
using Sedna.Core.Controls.Support;

namespace Sedna.Core.Controls
{
	/// <summary>
	/// Summary description for FilterFrame.
	/// </summary>
	[ParseChildren(false)]
	//[ControlBuilder(typeof(FilterFrameBuilder))]
	public class FilterFrame: Frame
	{
	    
		public FilterFrame()
		{
            JavascriptClass = "FilterFrame";
			ConfigurationId="configuration.default.FilterFrame";
		}
 

	    

	    public FilterFrame(IConfiguration configuration) : base(configuration)
	    {
	    }

	    protected override void AddParsedSubObject(object obj)
		{
			if (Content==null) 
			{
				if (obj is IClientScriptingControl)
				{
					Content=obj as Control;
				}
			}
		}

		protected override void OnPreRender(EventArgs e)
		{

			IClientScriptingControl clientScriptingControl=Content as IClientScriptingControl;
			if (clientScriptingControl!=null)
			{
				clientScriptingControl.ClientScriptingEnabled=true;
			}
			base.OnPreRender(e);		
		}


		protected override IDictionary BuildScriptParameters()
		{
            IDictionary parameters = base.BuildScriptParameters();
			parameters.Add("content", Content is IClientScriptingControl ? ((IClientScriptingControl)Content).ClientVariable : "null");
			return parameters;
		}



	}
}
